import { ChannelType } from '@/store/reducers/channel';
import request from '@/utils/request';
export type ChannelParamsType = { channels: ChannelType[] };
// 获取全部的频道
export const getAllChannelApi = () => {
  return request({
    url: '/v1_0/channels',
  });
};
//获取用户频道
export const getUserChannelApi = () => {
  return request({
    url: '/v1_0/user/channels',
  });
};

// 添加用户频道
export const addUserChannelApi = (data: ChannelParamsType) => {
  return request({
    url: '/v1_0/user/channels',
    method: 'patch',
    data,
  });
};
// 删除用户频道
export const delUserChannelApi = (id: number) => {
  return request({
    url: `/v1_0/user/channels/${id}`,
    method: 'delete',
  });
};
